package Gui;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import com.cloudgarden.resource.SWTResourceManager;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
/**
* Description : Show All directs 
* <p>
*
*@author Danielle
*/
public class ShowAll extends org.eclipse.swt.widgets.Composite {
	private Composite composite1;
	private Button cancel;
	private static Shell shell;
	private static String[] stringPrint;
	private Label[] textStr;

	/**
	* Auto-generated main method to display this 
	* org.eclipse.swt.widgets.Composite inside a new Shell.
	*/
//	public static void main(String[] args) {
//		showGUI();
//	}
	
	/**
	* Overriding checkSubclass allows this class to extend org.eclipse.swt.widgets.Composite
	*/	
	protected void checkSubclass() {
	}
	
	/**
	* Auto-generated method to display this 
	* org.eclipse.swt.widgets.Composite inside a new Shell.
	*/
	public static void showGUI(String[] str) {
		Display display = Display.getDefault();
		shell = new Shell(display);
		stringPrint=str;
		ShowAll inst = new ShowAll(shell, SWT.NULL);
		Point size = inst.getSize();
		shell.setLayout(new FillLayout());
		shell.layout();
		if(size.x == 0 && size.y == 0) {
			inst.pack();
			shell.pack();
		} else {
			Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y);
			shell.setSize(shellBounds.width, shellBounds.height);
		}
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	public ShowAll(org.eclipse.swt.widgets.Composite parent, int style) {
		super(parent, style);
		initGUI();
	}

	private void initGUI() {
		try {
			FormLayout thisLayout = new FormLayout();
			this.setLayout(thisLayout);
			{
				composite1 = new Composite(this, SWT.NONE);
				FormLayout composite1Layout = new FormLayout();
				FormData composite1LData = new FormData();
				composite1LData.left =  new FormAttachment(0, 1000, 0);
				composite1LData.top =  new FormAttachment(0, 1000, 0);
				composite1LData.width = 771;
				composite1LData.height = 560;
				composite1.setLayoutData(composite1LData);
				composite1.setLayout(composite1Layout);
				int size=stringPrint.length;
				int i;
				textStr=new Label[size];
				for (i=0; i<size; i++)
				{
					textStr[i]=new Label(composite1, SWT.NONE);
					FormData selectItemLData = new FormData();
					selectItemLData.left =  new FormAttachment(0, 1000, 30);
					selectItemLData.top =  new FormAttachment(10, 1000, 12);
					selectItemLData.width = 700;
					selectItemLData.height = 16;
					selectItemLData.left =  new FormAttachment(0, 1000, 30);
					selectItemLData.top =  new FormAttachment(10+i*30, 1000, 12);
					textStr[i].setLayoutData(selectItemLData);
					textStr[i].setText(""+stringPrint[i]);
					
				}
				{
					cancel = new Button(composite1, SWT.PUSH | SWT.CENTER);
					FormData cancelLData = new FormData();
					cancelLData.width = 60;
					cancelLData.height = 30;
					cancelLData.left =  new FormAttachment(907, 1000, 0);
					cancelLData.right =  new FormAttachment(985, 1000, 0);
					cancelLData.top =  new FormAttachment(922, 1000, 0);
					cancelLData.bottom =  new FormAttachment(975, 1000, 0);
					cancel.setLayoutData(cancelLData);
					cancel.setText("cancel");
					cancel.addSelectionListener(new SelectionAdapter() {
						public void widgetSelected(SelectionEvent evt) {
							shell.dispose();
						}
					});
				}
			}
			this.layout();
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
